package com.stu.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author MI
 * @ClassName WebInterceptorAdapter.java
 * @createTime 2021年11月26日 09:42:00
 */
@Configuration
public class WebInterceptorAdapter implements WebMvcConfigurer {
    /**
     * https://blog.csdn.net/LIUYEYEA/article/details/109626213
     * 应对引入xml 导致返回变成了 xml
     * @param configurer
     */
    @Override
    public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
        configurer.defaultContentType(MediaType.APPLICATION_JSON, MediaType.TEXT_XML, MediaType.APPLICATION_XML)
                .ignoreAcceptHeader(true);
    }
}
